ifeq ($(TOP_DIR),)
ifeq ($(TARGET_PRODUCT),mini)
ifneq ($(ARCH),arm64)
EXTRA_CFLAGS += -fstack-protector
endif
endif

ifeq ($(DAVINCI_HIAI_DKMS),y)
	EXTRA_CFLAGS += -I$(HIAI_DKMS_DIR)/pcie_host/soc
	EXTRA_CFLAGS += -I$(HIAI_DKMS_DIR)/pcie_host/soc/mini_v1
	EXTRA_CFLAGS += -I$(HIAI_DKMS_DIR)/common_h
	EXTRA_CFLAGS += -I$(HIAI_DKMS_DIR)/dev_inc
	EXTRA_CFLAGS += -I$(HIAI_DKMS_DIR)/inc/soc/mini_v1

else
	KERNEL_DIR := $(srctree)

	EXTRA_CFLAGS += -I$(PWD)/drivers/dev_inc
	EXTRA_CFLAGS += -I$(PWD)/drivers/dev_plat/devdrv/pcie_host/soc/
	EXTRA_CFLAGS += -I$(PWD)/drivers/dev_plat/devdrv/common_h

	ifeq ($(TARGET_PRODUCT),cloud)
	EXTRA_CFLAGS += -I$(PWD)/inc/soc/cloud_v1/
	EXTRA_CFLAGS += -I$(PWD)/drivers/dev_plat/devdrv/pcie_host/soc/cloud_v1
	EXTRA_CFLAGS += -DCFG_SOC_PLATFORM_CLOUD
	else
	EXTRA_CFLAGS += -I$(PWD)/inc/soc/mini_v1/
	EXTRA_CFLAGS += -I$(PWD)/drivers/dev_plat/devdrv/pcie_host/soc/mini_v1
	endif
endif

obj-m   += drv_pcie_host.o
drv_pcie_host-objs :=  devdrv_atu.o devdrv_dma.o devdrv_msg.o devdrv_ctrl.o devdrv_sysfs.o devdrv_pci.o devdrv_common_msg.o devdrv_device_load.o

drv_pcie_host-objs += soc/dma_comm_drv.o soc/nvme_comm_drv.o soc/apb_comm_drv.o

ifeq ($(TARGET_PRODUCT),cloud)
drv_pcie_host-objs += soc/cloud_v1/dma_drv.o soc/cloud_v1/nvme_drv.o soc/cloud_v1/apb_drv.o
else
drv_pcie_host-objs += soc/mini_v1/dma_drv.o soc/mini_v1/nvme_drv.o soc/mini_v1/apb_drv.o
endif
else
ifneq ($(findstring $(PRODUCT),  ascend310 ascend310rc ascend610 ascend710),)
ifneq ($(ARCH),arm64)
EXTRA_CFLAGS += -fstack-protector
endif
endif

ifeq ($(DAVINCI_HIAI_DKMS),y)
	EXTRA_CFLAGS += -I$(HIAI_DKMS_DIR)/pcie_host/soc
	EXTRA_CFLAGS += -I$(HIAI_DKMS_DIR)/pcie_host/soc/mini_v1
	EXTRA_CFLAGS += -I$(HIAI_DKMS_DIR)/common_h
	EXTRA_CFLAGS += -I$(HIAI_DKMS_DIR)/dev_inc
	EXTRA_CFLAGS += -I$(HIAI_DKMS_DIR)/inc/soc/mini_v1

else

	EXTRA_CFLAGS += -I$(TOP_DIR)/drivers/dev_inc
	EXTRA_CFLAGS += -I$(TOP_DIR)/drivers/dev_plat/devdrv/pcie_host/soc/
	EXTRA_CFLAGS += -I$(TOP_DIR)/drivers/dev_plat/devdrv/common_h

	ifeq ($(PRODUCT),ascend910)
	EXTRA_CFLAGS += -I$(TOP_DIR)/inc/soc/cloud_v1/
	EXTRA_CFLAGS += -I$(TOP_DIR)/drivers/dev_plat/devdrv/pcie_host/soc/cloud_v1
	EXTRA_CFLAGS += -DCFG_SOC_PLATFORM_CLOUD
	else
	EXTRA_CFLAGS += -I$(TOP_DIR)/inc/soc/mini_v1/
	EXTRA_CFLAGS += -I$(TOP_DIR)/drivers/dev_plat/devdrv/pcie_host/soc/mini_v1
	endif
endif

obj-m   += drv_pcie_host.o
drv_pcie_host-objs :=  devdrv_atu.o devdrv_dma.o devdrv_msg.o devdrv_ctrl.o devdrv_sysfs.o devdrv_pci.o devdrv_common_msg.o devdrv_device_load.o

drv_pcie_host-objs += soc/dma_comm_drv.o soc/nvme_comm_drv.o soc/apb_comm_drv.o

ifeq ($(PRODUCT),ascend910)
drv_pcie_host-objs += soc/cloud_v1/dma_drv.o soc/cloud_v1/nvme_drv.o soc/cloud_v1/apb_drv.o
else
drv_pcie_host-objs += soc/mini_v1/dma_drv.o soc/mini_v1/nvme_drv.o soc/mini_v1/apb_drv.o
endif



endif
